<%@ page import="java.util.Arrays" %><%--
  Created by IntelliJ IDEA.
  User: 14190
  Date: 2022/11/4
  Time: 9:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<%
    // 内置对象 (JSP中提供的直接可以使用的对象)

    // 1. out 打印输出到页面中
    for(int i=0;i<10;i++)
    {
        out.println("Hello world!"+i+"<br />");
    }

    // 2. request 请求对象
    String username = request.getParameter("username");
    out.println("用户名:"+username);
    String[] likes = request.getParameterValues("likes");
    out.println("爱好:"+Arrays.toString(likes));


    // 3. response 响应对象
    //response.sendRedirect("https://www.baidu.com");


    // 4. session 会话对象
    // 向会话中添加信息
    session.setAttribute("name","小明");


    // 5. applicaiton ServletContext对象 全局的域对象
    Integer count = (Integer)application.getAttribute("count");
    if(count==null) count=0;
    count++;
    out.println("网站总访问数:"+count);
    application.setAttribute("count", count);

    // 6. page 页面对象
    // 7. pageContext 页面域对象
    // 8. exception 异常对象


%>


</body>
</html>
